import { LcDocument } from '@/types/modules/editor/types/editor.type';
import { IPublicTypeRootSchema } from '@alilc/lowcode-types';
import {
  getCurrentFrame,
  getCurrentProjectId,
} from '@/utils/editor-adapter/editorResource';

export const createEmptyDocument = function ({
  type,
  fileName,
  title,
  folder,
}) {
  let schema: IPublicTypeRootSchema = {
    componentName: type || 'Page',
    fileName,
    title,
    meta: {
      title,
      folder,
    },
  };

  const document: LcDocument = {
    types: [],
    projectId: getCurrentProjectId(),
    type: type || 'Page',
    fileName,
    title,
    schema,
    folder,
    width: getCurrentFrame() === 'app' ? 375 : 1920,
    // route,
    // height,
    frames: [getCurrentFrame()],
    // clients,
    // portal,
    // backgroundColor,
  };
  return document;
};
